<?php

namespace common\models\shop;

use Yii;

/**
 * This is the model class for table "{{%shop_goods_spec}}".
 *
 * @property int $id
 * @property int $product_id 货品ID
 * @property int $goods_id 商品ID
 * @property int $spec_id 规格ID
 * @property int $spec_value_id 规格值ID
 * @property string $spec_value 规格值
 */
class ShopGoodsSpec extends \common\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%shop_goods_spec}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['product_id', 'goods_id', 'spec_id', 'spec_value_id'], 'integer'],
            [['spec_value'], 'required'],
            [['spec_value'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'product_id' => '货品ID',
            'goods_id' => '商品ID',
            'spec_id' => '规格ID',
            'spec_value_id' => '规格值ID',
            'spec_value' => '规格值',
        ];
    }

    public function fields() 
    {
        $fields = [
            'id',
            'product_id',
            'goods_id',
            'spec_id',
            'spec_value_id',
            'spec_value'
        ];
        return $fields;
    }
}
